<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/page/share/taglib.jsp" %>
<html>
<head>
<title>人员显示</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/modules.css" type="text/css"	media="screen" />
<link rel="stylesheet" href="/css/modules1.css" type="text/css"	media="screen" />
<link rel="stylesheet" href="/css/jquery-ui.css" type="text/css"	media="screen" />
<link rel="stylesheet" href="/css/jquery.wysiwyg.css" type="text/css"	media="screen" />

<style type="text/css">
	label{
			display:inline;
		}
	.input-medium{
			width:180px;
		}
</style>
		<!--Internet Explorer Trancparency fix-->
		<!--[if IE 6]>
    <script src="/js/ie6pngfix.js"></script>
    <script>
    DD_belatedPNG.fix('#head, a, a span, img, .message p, .click_to_close, .ie6fix');
    </script>
    <![endif]-->	
		<script type='text/javascript' src="/js/jquery-1.4.2.min.js"></script>	
		<script type='text/javascript' src="/js/jquery.js"></script>
		<script type='text/javascript' src="/js/jquery-ui.js"></script>
		<script type='text/javascript' src="/js/jquery.wysiwyg.js"></script>
		<script type='text/javascript' src="/js/custom.js"></script>
		<SCRIPT language=JavaScript src="/js/FoshanRen.js"></SCRIPT>
<script language="JavaScript">
	//到指定的分页页面
	function topage(page){
		var form = document.forms[0];
		form.page.value=page;
		form.submit();
	}
	
	function allSelect(){
		var form = document.forms[0];
		var state = form.allselectbox.checked;
		var length = form.ids.length;
		if(length){
			for(var i=0;i<length;i++){
				form.ids[i].checked=state;
			}
		}else{
			form.ids.checked=state;
		}
	}
	function allSelect(element){
		if(element.value=="选中全部"){
			$(":checkbox").attr("checked",true);
			element.value="取消全选";
		}else{
			$(":checkbox").attr("checked",false);
			element.value="选中全部";
		}
	}
	function _action(methodName){
		if(selectItem()){
			var form = document.forms[0];
			if(methodName=="enable")
				form.action='<s:url action="UserManage!enable"/>';
			else 
				form.action='<s:url action="UserManage!disable"/>';
			form.submit();
		}else{
			alert("请选择要操作的记录");
		}
	}
	//根据部门查询部门人员
	function findUserByDepartment(){
		var form = document.forms[0];
		form.submit();
	}
	
	function selectItem(){
		var form = document.forms[0];
		var length = form.ids.length;
		if(length){
			for(var i=0;i<length;i++){
				if(form.ids[i].checked) return true;
			}
		}else{
			return form.ids.checked;
		}
		return false;
	}
	
</script>
</head>

<body style="background-color:transparent">
	<div style="padding:10px;">
		<h2 class="jquery_tab_title">人员列表
		</h2>
	</div>
	<div>		
<s:form action="UserList" method="post" theme="simple">
<s:hidden name="page" />
<s:hidden name="query"/>
<s:hidden name="username"/>
<s:hidden name="realname"/>
  <table width="100%" cellpadding="0" cellspacing="0">
    <tr>
      <th class="th_first">&nbsp;</th>
      <th>姓名</th>
      <th>性别</th>
      <th>联系电话</th>
      <th>电子邮件</th>
      <th>部门</th>
      <th>权限</th>
      
      <th>修改</th>
       <th>设置权限</th>
       <th>状态</th>
    </tr>
<!---------------------------LOOP START------------------------------>
 <s:set name="pageView" value="#request.pageView.records"></s:set>
<s:iterator value="#pageView">
    <tr>
      <td class="td_first"><INPUT TYPE="checkbox" name="ids" value="${id }"></td>
      <td>${realname }&nbsp;</td>
      <td>${gender.name }&nbsp;</td>
      <td>${phone }&nbsp;</td>
      <td>${email }&nbsp;</td>
      <td>${department.name }&nbsp;</td>
      <td>${role.name }&nbsp;</td>
       <td><a href='<s:url action="UserManage!editUser" />?userid=<s:property value='id'/>'/>
      <img src="/images/edit.gif" width="15" height="16" border="0"></a></td>
      <td><a href="<s:url action='UserManage!privilegeGroupSetUI'/>?userid=<s:property value='id'/>">设置权限</a></td>
      <td>
      <s:if test="visible"><font color=green>启用</font></s:if>
      <s:else><font color=red>禁用</font></s:else>
      </td>
	</tr>
</s:iterator>
  </table>
  <div style="padding:10px;">
   		<span style="float:left">
   			<input type="button" class="button" value="选中全部" onclick="javascript:allSelect(this)"
					name="allselectbox" />
   			 <select id="departmentid" name="departmentid" onchange="javascript:findUserByDepartment()">
					<c:if test="${requestScope.myDepartment == null}">
						<option value="0">--请选择部门--</option>
					</c:if>
					
					<c:if test="${requestScope.myDepartment != null}">
						<option value="${myDepartment.id}">${myDepartment.name}</option>
					</c:if>
					<c:forEach items="${departments}" var="department">
						<option value="${department.id}">${department.name}</option>
					</c:forEach>
				</select>
              <input type="button" class="button" onClick="javascript:window.location.href='<s:url action="UserManage!addUser"/>'" value="添加员工">
				<input type="button" value=" 启 用 " class="button" onclick="javascript:_action('enable')">&nbsp;&nbsp;
				<input type="button" value=" 禁 用 " class="button" onclick="javascript:_action('disable')">
   		</span>
   		<span style="float:right">
   			<s:include value="/WEB-INF/page/share/fenye.jsp" />
   		</span>
   	</div>
</s:form>
</div>

</body>
</html>